package o;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import java.util.List;

public class dnx {
    private static byte[] ॱ = new byte[0];

    public static PackageInfo ˏ(String str, Context context) {
        try {
            return context.getPackageManager().getPackageInfo(str, 192);
        } catch (NameNotFoundException e) {
            Logger.e("PackageKit", "not found: " + str);
            return null;
        }
    }

    public static List<PackageInfo> ˊ(Context context, boolean z) {
        Throwable th;
        Throwable th2;
        List<PackageInfo> list = null;
        if (context != null) {
            PackageManager packageManager = context.getPackageManager();
            int i = 0;
            List<PackageInfo> list2 = null;
            while (true) {
                try {
                    synchronized (ॱ) {
                        try {
                            list = packageManager.getInstalledPackages(192);
                            try {
                            } catch (Throwable th3) {
                                th = th3;
                                list2 = list;
                                th2 = th;
                            }
                        } catch (Throwable th4) {
                            th2 = th4;
                            throw th2;
                        }
                    }
                } catch (Throwable th22) {
                    th = th22;
                    list = list2;
                    Logger.ˋ("PackageKit", "getInstalledPackages exception.", th);
                    int i2 = i + 1;
                    if (!z || i2 > 3) {
                        break;
                    }
                    i = i2;
                    list2 = list;
                }
            }
        }
        return list;
    }
}
